package org.ykh.cloudalibaba.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @author ykh
 * @create 2022-01-30 10:41
 */
@Configuration
public class ApplicationContextBean {
    @Bean
    //开启负载均衡功能，默认轮询
    //因为sprig-cloud-alibaba依赖netflix.ribbon
    @LoadBalanced
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }
}
